GPX: links aren't wpt only; implement for trk and rte, too.
authorrobertl <robertl>
Tue, 11 Sep 2007 10:29:44 +0000 (10:29 +0000)
committerrobertl <robertl>
Tue, 11 Sep 2007 10:29:44 +0000 (10:29 +0000)
gpx.c

diff --git a/gpx.c b/gpx.c
index bf9fcfd6b1a431a76c53b40da5cafd8ecf57dacb..514408c98c3f886af320830795c9f2c94cccc18e 100644 (file)
--- a/gpx.c
+++ b/gpx.c
@@ -896,22 +896,6 @@ gpx_end(void *data, const XML_Char *xml_el)
        /*
         * Waypoint-specific tags.
         */
-       case tt_wpt_url:
-               wpt_tmp->url = xstrdup(cdatastrp);
-               break;
-       case tt_wpt_urlname:
-               wpt_tmp->url_link_text = xstrdup(cdatastrp);
-               break;
-       case tt_wpt_link: {
-               char *lt = link_text;
-               if (lt) {
-                       lt = xstrdup(lrtrim(link_text));
-               }
-               
-               waypt_add_url(wpt_tmp, xstrdup(link_url), lt);
-               link_text = NULL;
-               }
-               break;
        case tt_wpt:
                waypt_add(wpt_tmp);
                logpoint_ct = 0;
@@ -1095,6 +1079,29 @@ gpx_end(void *data, const XML_Char *xml_el)
                                wpt_tmp->fix = fix_unknown;
                }
                break;
+       case tt_wpt_url:
+       case tt_trk_trkseg_trkpt_url:
+       case tt_rte_rtept_url:
+               wpt_tmp->url = xstrdup(cdatastrp);
+               break;
+       case tt_wpt_urlname:
+       case tt_trk_trkseg_trkpt_urlname:
+       case tt_rte_rtept_urlname:
+               wpt_tmp->url_link_text = xstrdup(cdatastrp);
+               break;
+       case tt_wpt_link: 
+//TODO: implement GPX 1.1      case tt_trk_trkseg_trkpt_link: 
+//TODO: implement GPX 1.1      case tt_rte_rtept_link: 
+               {
+               char *lt = link_text;
+               if (lt) {
+                       lt = xstrdup(lrtrim(link_text));
+               }
+               
+               waypt_add_url(wpt_tmp, xstrdup(link_url), lt);
+               link_text = NULL;
+               }
+               break;
        case tt_unknown:
                end_something_else();
                *s = 0;